home *** CD-ROM | disk | FTP | other *** search
/ .net 2002 March / DotNetMagazine-Issue107-Coverdisc-NET107-02-03-PCMac.bin / pc / PC Software / free_browsing / DavesQckSearchDbar3-14 / dqsd.exe / searches / timer.xml < prev    next >
Text File  |  2002-08-30  |  2KB  |  60 lines

  1. <search function="timer">
  2.   <name>Countdown Timer with Alarm</name>
  3.   <description>
  4.     Set a countdown timer with alert for x number of minutes.<br/>
  5.     <div class="helpboxDescLabels">Usage:</div>
  6.     <table class="helpboxDescTable">
  7.           <tr><td>Set Timer</td><td> - </td><td>timer <<i>minutes</i>> [<<i>message</i>>]</td></tr>
  8.           <tr><td>Cancel Timer</td><td> - </td><td>timer cancel</td></tr>
  9.         </table>
  10.     <div class="helpboxDescLabels">Examples:</div>
  11.     <table class="helpboxDescTable">
  12.           <tr><td>timer 60 Do status</td></tr>
  13.           <tr><td>timer cancel</td></tr>
  14.        </table>
  15.   </description>
  16.   <category>Functions</category>
  17.   <contributor>Monty Scroggins</contributor>
  18.   
  19.   <script><![CDATA[
  20.     var timernum;
  21.     function timer(t)
  22.     {
  23.       if( nullArgs("timer",t) )
  24.         return false;
  25.       
  26.       if (t != "" )
  27.       {
  28.         var parsed = t.split(" ");
  29.         var time = parsed.shift();
  30.         if (time.match(/cancel/))
  31.         {
  32.           clearInterval(timernum);
  33.           document.deff.q.value="Timer Canceled..";
  34.           setTimeout("document.deff.q.value='';",1000);
  35.           return;
  36.         }
  37.         if(! time.match(/^\.*\d+$/) )
  38.         {
  39.           window.alert("Bad minutes '" + time + "' entered..  should be \'timer <minutes> <message>\'");
  40.           return;
  41.         }
  42.         var timermsg = 'Timer Expired';
  43.         if( parsed[0] != null && parsed[0].length != 0 )
  44.         {
  45.           timermsg = parsed.join(' ');
  46.         }
  47.         document.deff.q.value = "Timer Set..";
  48.         setTimeout("document.deff.q.value='';",1000);
  49.         timernum = setTimeout("window.alert('" + timermsg + "');",time*1000*60);
  50.       }
  51.     }//end function
  52.   ]]></script>
  53.  
  54.   <copyright>
  55.     Copyright (c) 2002 David Bau
  56.     Distributed under the terms of the
  57.     GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  58.   </copyright>
  59. </search>
  60.